﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TransCend.Util
{
    /// <summary>
    /// 读取配置信息
    /// </summary>
    public class Resources
    {
        private static readonly Resources rs = new Resources();
        private Resources()
        {

        }

        public static Resources GetResources()
        {
            return rs;
        }

        public string GetText(string key)
        {
            return System.Configuration.ConfigurationManager.AppSettings[key];
        }

        public int GetInt(string key)
        {
            string val = GetText(key);
            if (val == null) return 0;
            return int.Parse(val);
        }

        public bool GetBool(string key)
        {
            string val = GetText(key);
            if (val == null) return false;
            return bool.Parse(val);
        }
    }
}
